<?php include_once ('function/check_login_function.php'); onlyValid();?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Health Tracker</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Health Tracker">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <style>
      body {
        padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
      }
    </style>
    <link href="css/bootstrap-responsive.css" rel="stylesheet">
    <link rel="shortcut icon" href="ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
  </head>

  <body>


<?php include_once('nav.php'); ?>
      
    <div class="container">
    <div class="row">
    <div class="span5">
    <h1 style="padding-left: 20px;">Hospitals</h1><br />

					<?php 
					$hospital_list = Hospital::getHospitalList();
					if ($hospital_list !== null) {
						foreach ($hospital_list as $hospital) {

							echo '<div class="alert alert-success">';

							echo '<h4>' . $hospital['hospital_name'] . '</h4>';
                            echo '<form action="doctors.php" method="POST">';
							echo '<input type="hidden" id="hospitalID" name="hospitalID" value="' . $hospital['hospital_id'] . '"/>';
							echo '<input type="hidden" id="from" name="from" value="hospitals"/>';
							echo '<button type="submit" name="selectHospital" class="btn pull-right">Select</button>';
							echo '</form>';	
							if ($hospital['hospital_address'] !== "") {
								echo $hospital['hospital_address'] . '<br/>';
							} else {
								echo constant("MSG_ADDRESS_NONE") . '<br/>';
							}
							if ($hospital['hospital_contact'] !== "") {
								echo $hospital['hospital_contact'] . '<br/>';
							} else {
								echo constant("MSG_CONTACT_NONE") . '<br/>';
							}
		
							echo '</div>';
						}
					}
					?>	
    </div>
    </div>
    </div> <!-- /container -->
  </body>
</html>